package cn.iocoder.yudao.module.system.dal.mysql.tenantconfig;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.dal.dataobject.tenantconfig.TenantConfigDO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.system.controller.admin.tenantconfig.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 租户参数配置 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface TenantConfigMapper extends BaseMapperX<TenantConfigDO> {

    IPage<TenantConfigDO> customSelect(IPage<TenantConfigDO> mpPage, @Param("reqVO") TenantConfigPageReqVO reqVO);

    default PageResult<TenantConfigDO> selectPage(TenantConfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TenantConfigDO>()
                .eqIfPresent(TenantConfigDO::getConfigId, reqVO.getConfigId())
                .eqIfPresent(TenantConfigDO::getValue, reqVO.getValue())
                .eqIfPresent(TenantConfigDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(TenantConfigDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TenantConfigDO::getId));
    }

    default List<TenantConfigDO> selectList(TenantConfigExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<TenantConfigDO>()
                .eqIfPresent(TenantConfigDO::getConfigId, reqVO.getConfigId())
                .eqIfPresent(TenantConfigDO::getValue, reqVO.getValue())
                .eqIfPresent(TenantConfigDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(TenantConfigDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TenantConfigDO::getId));
    }

}
